package viewbuilder

class TablePage {

    def render(builder, rows) {

        builder.html {
            head {
                title("My Page")
            }
            body {
                p("Put the table here:")
                table {
                    rows.eachWithIndex { row, i ->
                        tr('class':(i.mod(2) == 0)?'highlight':'') {
                            td("col1")
                            td("col2")
                        }
                    }
                }
            }
        }

    }

}